package com.probiz.estore.common.model.order.base;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.order.OrderPick;
import com.probiz.estore.common.model.product.ProductSku;
import com.probiz.estore.core.model.BaseObject;

/**
 * OrderPickItem Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class OrderPickItemTbl extends BaseObject implements Serializable {

    protected Integer orderPickItemId;
	protected Short itemType;
	protected Integer productId;
	protected String productName;
	protected String productSkuCode;
	protected String displaySkuOptions;
	protected Integer pickQuantity;
	protected ProductSku productSku;
	protected OrderPick orderPick;


	/**
	 * Default Empty Constructor for class OrderPickItem
	 */
	public OrderPickItemTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class OrderPickItem
	 */
	public OrderPickItemTbl (
		 Integer in_orderPickItemId
        ) {
		this.setOrderPickItemId(in_orderPickItemId);
    }

	
	public ProductSku getProductSku () {
		return productSku;
	}	
	
	public void setProductSku (ProductSku in_productSku) {
		this.productSku = in_productSku;
	}
	
	public OrderPick getOrderPick () {
		return orderPick;
	}	
	
	public void setOrderPick (OrderPick in_orderPick) {
		this.orderPick = in_orderPick;
	}
    

	/**
	 * 	 * @return Integer
     * @hibernate.id column="orderPickItemId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getOrderPickItemId() {
		return this.orderPickItemId;
	}
	
	/**
	 * Set the orderPickItemId
	 */	
	public void setOrderPickItemId(Integer aValue) {
		this.orderPickItemId = aValue;
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getOrderPickId() {
		return this.getOrderPick()==null?null:this.getOrderPick().getOrderPickId();
	}
	
	/**
	 * Set the orderPickId
	 */	
	public void setOrderPickId(Integer aValue) {
	    if (aValue==null) {
	    	orderPick = null;
	    } else {
	        orderPick = new OrderPick(aValue);
	        orderPick.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 备货明细项的类型
            1=商品
            3=礼品
            	 * @return Short
	 * @hibernate.property column="itemType" type="java.lang.Short" length="5" not-null="true" unique="false"
	 */
	public Short getItemType() {
		return this.itemType;
	}
	
	/**
	 * Set the itemType
	 * @spring.validator type="required"
	 */	
	public void setItemType(Short aValue) {
		this.itemType = aValue;
	}	

	/**
	 * 货品id	 * @return Integer
	 */
	public Integer getProductSkuId() {
		return this.getProductSku()==null?null:this.getProductSku().getProductSkuId();
	}
	
	/**
	 * Set the productSkuId
	 */	
	public void setProductSkuId(Integer aValue) {
	    if (aValue==null) {
	    	productSku = null;
	    } else {
	        productSku = new ProductSku(aValue);
	        productSku.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 商品id	 * @return Integer
	 * @hibernate.property column="productId" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getProductId() {
		return this.productId;
	}
	
	/**
	 * Set the productId
	 */	
	public void setProductId(Integer aValue) {
		this.productId = aValue;
	}	

	/**
	 * 商品名称	 * @return String
	 * @hibernate.property column="productName" type="java.lang.String" length="512" not-null="false" unique="false"
	 */
	public String getProductName() {
		return this.productName;
	}
	
	/**
	 * Set the productName
	 */	
	public void setProductName(String aValue) {
		this.productName = aValue;
	}	

	/**
	 * 货品编号	 * @return String
	 * @hibernate.property column="productSkuCode" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getProductSkuCode() {
		return this.productSkuCode;
	}
	
	/**
	 * Set the productSkuCode
	 */	
	public void setProductSkuCode(String aValue) {
		this.productSkuCode = aValue;
	}	

	/**
	 * 规格字符串 用于显示skuOption;
            格式optionName1:optionValue1;optionName2:optionValue2
            例如:color:red;size:xl	 * @return String
	 * @hibernate.property column="displaySkuOptions" type="java.lang.String" length="255" not-null="false" unique="false"
	 */
	public String getDisplaySkuOptions() {
		return this.displaySkuOptions;
	}
	
	/**
	 * Set the displaySkuOptions
	 */	
	public void setDisplaySkuOptions(String aValue) {
		this.displaySkuOptions = aValue;
	}	

	/**
	 * 备货数量	 * @return Integer
	 * @hibernate.property column="pickQuantity" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getPickQuantity() {
		return this.pickQuantity;
	}
	
	/**
	 * Set the pickQuantity
	 * @spring.validator type="required"
	 */	
	public void setPickQuantity(Integer aValue) {
		this.pickQuantity = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof OrderPickItemTbl)) {
			return false;
		}
		OrderPickItemTbl rhs = (OrderPickItemTbl) object;
		return new EqualsBuilder()
				.append(this.orderPickItemId, rhs.orderPickItemId)
						.append(this.itemType, rhs.itemType)
						.append(this.productId, rhs.productId)
				.append(this.productName, rhs.productName)
				.append(this.productSkuCode, rhs.productSkuCode)
				.append(this.displaySkuOptions, rhs.displaySkuOptions)
				.append(this.pickQuantity, rhs.pickQuantity)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.orderPickItemId) 
						.append(this.itemType) 
						.append(this.productId) 
				.append(this.productName) 
				.append(this.productSkuCode) 
				.append(this.displaySkuOptions) 
				.append(this.pickQuantity) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("orderPickItemId", this.orderPickItemId) 
						.append("itemType", this.itemType) 
						.append("productId", this.productId) 
				.append("productName", this.productName) 
				.append("productSkuCode", this.productSkuCode) 
				.append("displaySkuOptions", this.displaySkuOptions) 
				.append("pickQuantity", this.pickQuantity) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "orderPickItemId";
	}
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return orderPickItemId;
	}

}